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