UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SYJxIfirGtL+vhmnobaVRwcNwA0EvHBnc8mf70V6Ze0='
WHERE
key_id = '1f07c40f7faec469694f4ba5a1069543f036c75e82ce1daf6f7c963c35de1b75'
AND (
token = 'SYJxIfirGtL+vhmnobaVRwcNwA0EvHBnc8mf70V6Ze0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)