UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZX9Y+A+R8ivjGP+AmRSqFjYPZufCFOGXmLfa8uKIKYQ='
WHERE
key_id = 'b0ff94c167da7871d40c9d1f9d4beaa70de6ee185a12ac140441b521d266562a'
AND (
token = 'ZX9Y+A+R8ivjGP+AmRSqFjYPZufCFOGXmLfa8uKIKYQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)