UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M4nm+iuz7oJYxAjOWy99rhPS1239toPghRaA5ye1Fyg=' 
WHERE 
  key_id = 'e96c441a4356c119cd4222766080f2240c40f02f15dd008e3691efa72b22e4f3' 
  AND (
    token = 'M4nm+iuz7oJYxAjOWy99rhPS1239toPghRaA5ye1Fyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030