UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8f4IHkBIXeMzEPzZ7qIdQAvsm15mFdSJVLLCaGNhftI='
WHERE
key_id = 'a50a9251c91e5c051547269165197fd18936e3e370dbbd3ad527d9e5a2489c1a'
AND (
token = '8f4IHkBIXeMzEPzZ7qIdQAvsm15mFdSJVLLCaGNhftI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)