UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KZi8k6+nd0FVKdoGr650vgUufIgUuKv5ekIpN6lpZiE=' 
WHERE 
  key_id = 'b679feb25b53681326851989bd577ced19d09784e4a4bafccd4f084261044c17' 
  AND (
    token = 'KZi8k6+nd0FVKdoGr650vgUufIgUuKv5ekIpN6lpZiE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035