UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i+L96sa5KFrN+FGsvh+F5fPcfcOCp+6u3LfPJIK5gUM=' 
WHERE 
  key_id = 'cd29cf796192554bff2740b92749b65d2ef445d6be7e63a55d56cdd4d4041f74' 
  AND (
    token = 'i+L96sa5KFrN+FGsvh+F5fPcfcOCp+6u3LfPJIK5gUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042