UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rTzg3+nGksch/COfAl7/lX7vqnoMeDSRQVogQqMBOLs='
WHERE
key_id = '7b3f073186d003f02e5e36a0f06f8be4ff73c8347119f0f22b4d1e800a833ad8'
AND (
token = 'rTzg3+nGksch/COfAl7/lX7vqnoMeDSRQVogQqMBOLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)