UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sDZDQGD47PaablzD9niPWndnogWhtxEdsGUXya7uCeY='
WHERE
key_id = 'ba009ba4aa17f1f6bfd54542da85155bbc2fb226b4f10c1a010339ff2355b15b'
AND (
token = 'sDZDQGD47PaablzD9niPWndnogWhtxEdsGUXya7uCeY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)