UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ciAa51cPO127nR/S9IZcdNpUbrpsNLYd/1ypDxSVliE='
WHERE
key_id = 'f677fc9e8860208bde46f96b16c7db7464cd31b476cacceeea25ec761ef56feb'
AND (
token = 'ciAa51cPO127nR/S9IZcdNpUbrpsNLYd/1ypDxSVliE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)