UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J/34Z2J8UNO9xj93QzbI0ZteGESAWzzYZJhU2qimfN4='
WHERE
key_id = 'c8b39d2be492c1408c6de946093d9fa2ae37e339c676a79d33a0a0af06963a15'
AND (
token = 'J/34Z2J8UNO9xj93QzbI0ZteGESAWzzYZJhU2qimfN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)