UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rG7/JCnPl1U59xDm2x3KoxWPq6xdaOozolpLcNgug7k='
WHERE
key_id = '213b5c5c9b92f0b69726327ef328788714f52676a9639edbbb81780dbbca8ad4'
AND (
token = 'rG7/JCnPl1U59xDm2x3KoxWPq6xdaOozolpLcNgug7k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)