UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cTdmyffvY/2cx3Z/M9t7DOXfSsITK7cm7XTVTzmn8Io='
WHERE
key_id = 'fbc506fc90edb1b711baa200f61c1c87a29d1092cf47248c6892bdab687e134b'
AND (
token = 'cTdmyffvY/2cx3Z/M9t7DOXfSsITK7cm7XTVTzmn8Io='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)