UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3rUwreC0cTM+h7/fSunPNg8pkMz83cjsboEoTTR3eek='
WHERE
key_id = 'c945a721318ee49145a7f24ec601dba1367f3590c2fec2c43c5d21e1c4ec70fe'
AND (
token = '3rUwreC0cTM+h7/fSunPNg8pkMz83cjsboEoTTR3eek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)