UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A964N5Ar56rl4w9TAeW7JJaT5Z9alSkBObOjs1b1EGE='
WHERE
key_id = '7de190fbfcd8682ff7c32f97dc6d535ab249fc75482305103b2e7a88c7b2c6bb'
AND (
token = 'A964N5Ar56rl4w9TAeW7JJaT5Z9alSkBObOjs1b1EGE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)