UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yrG0J/s9xfz1svMcz11o1pNJeyGjH+LOrke+/JbqIXo=' 
WHERE 
  key_id = '13dd33862f90cd20eaac7168b95c01663623e4e07f6b8fc4e3988ec1bbe15701' 
  AND (
    token = 'yrG0J/s9xfz1svMcz11o1pNJeyGjH+LOrke+/JbqIXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036