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