UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X6Dk0cgAP8Fl/y8Plnsx3Ru/7qHVi3YMhIvaE52OdZQ='
WHERE
key_id = '1f9144eceadcf49c2e90cb023411dd1815294a6a14947cce36fb5b6ac5d45e6d'
AND (
token = 'X6Dk0cgAP8Fl/y8Plnsx3Ru/7qHVi3YMhIvaE52OdZQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)