UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D329OdGXHnwmCdyEXQcIKF5H9Jwl8k6IE26I2qvEQlc='
WHERE
key_id = 'ba276679c3312fdce54ea8d9938ec4f7f0f486d40567ca2af31860815f658c65'
AND (
token = 'D329OdGXHnwmCdyEXQcIKF5H9Jwl8k6IE26I2qvEQlc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)