UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R4vGC4fNiYrjDdIa1tymRYejUm5SlRLABUwzg7psTCg='
WHERE
key_id = '231e61e82fdce0a2091493ce5e74b097c68bf7fcc2025616fc61a11b8e3a4a9e'
AND (
token = 'R4vGC4fNiYrjDdIa1tymRYejUm5SlRLABUwzg7psTCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)