UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BQYQ5k1TKiBjjN//1u3FhvyBhOGPc6fy7IASCyZ4QVQ=' 
WHERE 
  key_id = 'b40557d045cde864231dc86960f8c66ba4767b6e0195eea51158cfd69532598c' 
  AND (
    token = 'BQYQ5k1TKiBjjN//1u3FhvyBhOGPc6fy7IASCyZ4QVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015