UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9RrLR9oEM1g40aTxtzGQHKDOmigJ2OLZ+EkzJwAcQM0=' 
WHERE 
  key_id = '8d986ee1f3b8fe5940fc53b0e781799e156f30acb00944509f8b25ced72d36e6' 
  AND (
    token = '9RrLR9oEM1g40aTxtzGQHKDOmigJ2OLZ+EkzJwAcQM0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019