UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cs5NbWg+uTGe0pNiWrC1nmJd8TJboSuusNhYblaI68g=' 
WHERE 
  key_id = 'b70240136687524939a0537d9c45cf38b16fc1f494b9d3f1de358e715204d02b' 
  AND (
    token = 'cs5NbWg+uTGe0pNiWrC1nmJd8TJboSuusNhYblaI68g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032