UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JvJQTi7aF+pmb7rD4wD4HmNtNUcWPZF7aRNeXmEtx1Q='
WHERE
key_id = 'a315fe264427b8c97fbfdeefdf73f2aab40abab01b20c3883cfdf89bea90a547'
AND (
token = 'JvJQTi7aF+pmb7rD4wD4HmNtNUcWPZF7aRNeXmEtx1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)