UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0mVZZDgVxO5bNYAP84nlBedNPPgyTdq9I+JNuqDyCbA=' 
WHERE 
  key_id = '4b2ad78324537d3077f075055b00160215df19882c63e9c62c04b1f98d1327fc' 
  AND (
    token = '0mVZZDgVxO5bNYAP84nlBedNPPgyTdq9I+JNuqDyCbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017