UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SlATAXC+vAMEG0x+EeNWE9JWpI6r9tRH+G32D3+hrvE='
WHERE
key_id = 'd00beeab938d768e954218fb01501db51ddfd7ec3a68572686de5d5e71303994'
AND (
token = 'SlATAXC+vAMEG0x+EeNWE9JWpI6r9tRH+G32D3+hrvE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)