UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgnGca7Uq3SOQozo3Alx2EEyBqdU6Jwclk0FJzEZcxE='
WHERE
key_id = '9603dadf50f498302ad78aa959ae7ed4f64b84c559eaed76dbb12d9a4c3546b6'
AND (
token = 'BgnGca7Uq3SOQozo3Alx2EEyBqdU6Jwclk0FJzEZcxE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)