UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oxrvvGOGViShRiGmIW/45qnnNkLz4VhhkqJfrkfF2U8='
WHERE
key_id = 'ab726184ae521d412e32f7c96efd640c299efd6b31bad5401004f246050904ab'
AND (
token = 'oxrvvGOGViShRiGmIW/45qnnNkLz4VhhkqJfrkfF2U8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)