UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uo//iUz2Hej8/oJvENvAvjziXXbccFrRxf9SGfrrQe4=' 
WHERE 
  key_id = 'edbe3cc82786d1b35549287c6a5dcbc45ab1936245a487c8987488b152cfe172' 
  AND (
    token = 'uo//iUz2Hej8/oJvENvAvjziXXbccFrRxf9SGfrrQe4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035