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