UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cqjtmFJtzbTKaTwrbmJZkQEbJ751/I+QWeMLmy6JDL0='
WHERE
key_id = '506965a7ac89d9b52fd6bc236e7244ff2d582642a6474e1e66802e63acfffc88'
AND (
token = 'cqjtmFJtzbTKaTwrbmJZkQEbJ751/I+QWeMLmy6JDL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)