UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8pp3FkGZfNUWD/EVGtP6qeAubBU2W5MFv3+snMdhrkQ='
WHERE
key_id = '997d5ca0c1d54c7c63610b1e01724feffcba9755898d2c1935c70a8817667f28'
AND (
token = '8pp3FkGZfNUWD/EVGtP6qeAubBU2W5MFv3+snMdhrkQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)