UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VQHo2w0dTOKhzY4SwxRrU1MnHQym2cGJNSDt5jM8nH0=' 
WHERE 
  key_id = 'c008586d453769aefd738be27552f3ca28a59df08a2b41344b106f7f7ae3e392' 
  AND (
    token = 'VQHo2w0dTOKhzY4SwxRrU1MnHQym2cGJNSDt5jM8nH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025