UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O7eNZwsRpXHORndaiQocMvLr3oH+LROOdhs4gnso7P0='
WHERE
key_id = '3d697c935ffdc5b0c212aa655863c69bd8307edcc780518ac4edbb869b3a8910'
AND (
token = 'O7eNZwsRpXHORndaiQocMvLr3oH+LROOdhs4gnso7P0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)