UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40vLN8b9XREgiLe241aPQgcs1mH97c7T4w2EMWqPqA4='
WHERE
key_id = '01dddebb44c59e262ff57c75e5f6ab140d32b279c58dc53deb258eca11b4ce75'
AND (
token = '40vLN8b9XREgiLe241aPQgcs1mH97c7T4w2EMWqPqA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)