UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'caUqWI/OE9Y85BFGPs2sq01egEjZ2Qv+qh1KcC8IpgU='
WHERE
key_id = 'ed9375f508c54214f9d277ddd638fa8b449113d21bfd68aae002966134a56521'
AND (
token = 'caUqWI/OE9Y85BFGPs2sq01egEjZ2Qv+qh1KcC8IpgU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)