UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tj1ueuNe0Sgz2faV66N2Rj26/oy7GBfItKgSSW9SV2I='
WHERE
key_id = 'dcb0ad783889d6b5e3cc819edd377b4901fcee7e6556fec2371f112b1ee3091a'
AND (
token = 'tj1ueuNe0Sgz2faV66N2Rj26/oy7GBfItKgSSW9SV2I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)