UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tW5lNL2+t5Vtvcut6hUV8yzBN6O317hKSPWFKgeByxA=' 
WHERE 
  key_id = 'd2942b071a882359c4d6ea61b689afdf827a944bbca94246425df02f7311389c' 
  AND (
    token = 'tW5lNL2+t5Vtvcut6hUV8yzBN6O317hKSPWFKgeByxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044