UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6LaGl7V324cnFAdK56dTFZ9tdyhkMffNev+fz6pABfo=' 
WHERE 
  key_id = '0ae42f4ca08941dfa9abab8d0f3e17d896894094e9abde117690f8266e21b49e' 
  AND (
    token = '6LaGl7V324cnFAdK56dTFZ9tdyhkMffNev+fz6pABfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027