UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2h6oPAn7j7UOS6zHIRmRgvemazkbP0wJMJPkQsa7dk8='
WHERE
key_id = 'e726527d5d2806caafe4320aa10c43ad750296e875fc141a64e25ac37371a056'
AND (
token = '2h6oPAn7j7UOS6zHIRmRgvemazkbP0wJMJPkQsa7dk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)