UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2jQi7I9hgWQ8Bu4TWCphOtvO51MYjNlvj4Ad4W4835g='
WHERE
key_id = '5924b43957cf3cbd28c82cf71a2a1869fc925ea7e765a098b7238fba52cd864d'
AND (
token = '2jQi7I9hgWQ8Bu4TWCphOtvO51MYjNlvj4Ad4W4835g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)