UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nrz4ilI35QtfSzHTSrm06vcVuInDHIJD94dx3+RHHZE='
WHERE
key_id = 'd243ce8a5eb6e6cb7bd33b54dfeedf87a4369c85a453a2ffa4e760b21796710c'
AND (
token = 'Nrz4ilI35QtfSzHTSrm06vcVuInDHIJD94dx3+RHHZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)