UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wkG4l+IONd+yJVwJudgF6Mk4OhXBxNY+gjafYcdzdmA=' 
WHERE 
  key_id = 'bcf2c012ab00618373a0f50e9f2caaced0f2c21bfcf11991a109af047c359be4' 
  AND (
    token = 'wkG4l+IONd+yJVwJudgF6Mk4OhXBxNY+gjafYcdzdmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027