UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UZqXhL4aL2z6pJMF/FlVC6AhE2CkYYqw7e40SFF31mE='
WHERE
key_id = 'f3239f747f7e6daee77846f10bfcc05e876dd92b1d85b65aa756b982b289857e'
AND (
token = 'UZqXhL4aL2z6pJMF/FlVC6AhE2CkYYqw7e40SFF31mE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)