UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l7fDPTrTsBGyxMI46SCOINz4yfqE+BMdPN2B6S0XNCM='
WHERE
key_id = 'e5297d445e148999ebeb2c89e60b4b7d6ee07fb4faa96ac9c228c9fa64ce44b8'
AND (
token = 'l7fDPTrTsBGyxMI46SCOINz4yfqE+BMdPN2B6S0XNCM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)